package controler.userCommands;
import controler.A_State;
import controler.A_UserCommand;

/**
 * @author Damien Mabin
 */

class AddToSelection<T> extends A_UserCommand
{

	var m_ElementToAdd 	: T;
	var m_Class			: Class<T>;
	
	public function new(_NextModelState:A_State, _Class:Class<T>, _Elt:T) 
	{
		super(_NextModelState);
		m_CanBeUndo = true;
		m_ElementToAdd = _Elt;
		m_Class = _Class;
	}
	
	override public function DoCommand():Void 
	{
		super.DoCommand();
		A_UserCommand.s_Model.CTRL_AddToSelection(m_Class, m_ElementToAdd);
	}
	
	override public function UndoCommand():Void 
	{
		A_UserCommand.s_Model.CTRL_RemoveFromSelection(m_Class, m_ElementToAdd);
		super.UndoCommand();
	}
	
}